/**
 * File IRequestDAO.java created by Pablo Díaz Fernández
 * on Dec 21, 2011 for the project supply-chain-simulator
 */
package org.lsk.pfc.scsim.model.persistence.dao;

import java.util.List;

import org.lsk.pfc.scsim.model.persistence.dto.RequestDTO;

/**
 * Interface to RequestDAOs.
 * 
 * @author Pablo Díaz Fernández
 */
public interface IRequestDAO {

	/**
	 * Retrieves the object specified by the id from the database.
	 * 
	 * @param dto
	 *            DTO that contains the identifier of the object to retrieve.
	 * @return {@link RequestDTO} found or <code>null</code> if no one matches.
	 */
	RequestDTO retrieve(RequestDTO dto);

	/**
	 * Finds all object that match with the specified template.
	 * 
	 * @param dto
	 *            {@link RequestDTO} template to search.
	 * @return {@link List} of {@link RequestDTO} found.
	 */
    List<RequestDTO> list(final RequestDTO dto);

	/**
	 * Creates the {@link RequestDTO} in database or updates it if already
	 * exists.
	 * 
	 * @param dto
	 *            Object to persist.
	 * @return Object persisted.
	 */
	RequestDTO createOrUpdate(final RequestDTO dto);

	/**
	 * Deletes the object from the database.
	 * 
	 * @param dto
	 *            DTO that contains the identifier of the object to delete.
	 */
	void delete(final RequestDTO dto);
}
